package com.fzy.servlet;

import com.fzy.Service.Service;
import com.fzy.Service.ServiceImpl;
import com.fzy.beansa.Employee;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@WebServlet(name = "GetAllEmployeeServlet", value = "/GetAllEmployeeServlet")
public class GetAllEmployeeServlet extends ViewBaseServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("GetAllEmployeeServlet");
        Service service = new ServiceImpl();
        List<Employee> allemployee = new ArrayList<>();
        allemployee = service.getAllEmployee();
        request.setAttribute("employeelist", allemployee);
        this.processTemplate("showallemployee", request, response);

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    }
}